Skip to content

fix(python-client): async=true silently ignored on retain#709

Merged
nicoloboschi merged 3 commits intomainfrom
fix/python-client-async-retain
Mar 26, 2026
Merged

fix(python-client): async=true silently ignored on retain#709
nicoloboschi merged 3 commits intomainfrom
fix/python-client-async-retain

Conversation

@nicoloboschi
Copy link
Copy Markdown
Collaborator

Summary

  • RetainRequest was constructed with async_=retain_async, but the generated Pydantic model field is var_async (alias "async"). The async_ kwarg matched neither, so Pydantic silently dropped it — every retain call ran synchronously regardless of the flag.
  • Not a regression — broken since the client wrapper was first introduced (6073ac4f).
  • Adds unit tests verifying async field serialization to prevent future regressions.

Test plan

  • New unit tests pass (uv run pytest tests/test_retain_request_async.py)
  • Verify with a running server that retain_async=True now returns immediately with an operation_id

Add missing settings (retainMode, retainToolCalls, retainTags,
retainMetadata, embedPackagePath, llmApiKeyEnv, agentName, and
several recall options) that existed in code but not in docs.
Restructure config tables with prose introductions, clearer
descriptions, and consistent layout across both files.
Unused client-side cap — Hindsight server already controls result
count via recallBudget and recallMaxTokens.
The hand-written client wrapper passed `async_=retain_async` to
RetainRequest, but the generated Pydantic model uses `var_async` as the
Python field name (with `alias="async"`). The `async_` kwarg didn't
match either the field name or the alias, so Pydantic silently ignored
it — every retain call ran synchronously regardless of the flag.

This has been broken since the client was first introduced (6073ac4),
not a regression.

Also adds unit tests that verify the async field serializes correctly
in the request JSON, preventing future regressions.
@nicoloboschi nicoloboschi merged commit c9ff37d into main Mar 26, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant